package com.cauli.search.service;

import co.elastic.clients.elasticsearch.core.SearchResponse;
import com.cauli.search.model.dto.FileSearchDTO;
import com.cauli.search.model.dto.SearchFileQueryDTO;
import com.cauli.search.model.vo.SearchFileVO;

import java.io.IOException;
import java.util.List;

/**
 * @author Cauli
 * @date 2023/9/1 20:58
 * @description Elasticsearch 服务类
 */
public interface ElasticsearchService {
    /**
     * 创建索引
     *
     * @param indexName
     * @return
     * @throws IOException
     */
    boolean createIndex(String indexName);

    /**
     * 更新ES数据
     *
     * @param fileSearchDTO
     */
    void uploadES(FileSearchDTO fileSearchDTO);

    /**
     * 删除ES数据
     *
     * @param userFileId
     */
    void deleteES(Long userFileId);


    /**
     * 搜索ES数据
     *
     * @return
     */
    List<SearchFileVO> searchES(SearchFileQueryDTO searchFileVO);
}
